package cn.glc.daily.life.model.dto.dict;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;

/**
 * 字典新增DTO
 *
 * @author simon
 * @date 2021/4/13 12:00
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Data
@EqualsAndHashCode()
@ApiModel(value = "字典新增and修改DTO", description = "")
public class DictSaveOrUpdateDto {

    /**
     * 对外唯一key
     */
    @ApiModelProperty(value = "唯一值", example = "10000001")
    private String code;
    /**
     * 父节点的值 e.g:0
     */
    @ApiModelProperty(value = "父节点值", example = "10000001")
    private String parentCode;
    /**
     * 字典名称
     */
    @ApiModelProperty(value = "字典名称", example = "字典名称")
    @NotBlank(message = "名称不能为空")
    private String title;
    /**
     * 字典标签名对应的值
     */
    @ApiModelProperty(value = "字典标签名对应的值", example = "字典标签名对应的值")
    @NotBlank(message = "标签值不能为空")
    private String dictValue;
    /**
     * 序号(10的整数倍)
     */
    @ApiModelProperty(value = "序号(10的整数倍)", example = "序号(10的整数倍)")
    @Min(value = 0)
    @Max(value = 10000)
    private Short sequence;
    /**
     * 备注
     */
    @ApiModelProperty(value = "备注", example = "备注")
    private String remark;
    /**
     * 权重(10的整数倍)
     */
    @ApiModelProperty(value = "权重(10的整数倍)", example = "权重(10的整数倍)")
    private Short weight;
    /**
     * 是否禁用,0:启用/1:禁用
     */
    @ApiModelProperty(value = "是否禁用", example = "是否禁用")
    @JsonSerialize(using = ToStringSerializer.class)
    private Boolean isOpen;

}
